package com.social.servlet;

import com.social.dao.LogDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Delete_Log", value = "/Delete_Log")
public class Delete_Log extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              response.sendRedirect("delete-button.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html; charset=UTF-8");
        LogDao l = new LogDao();

//        日志id需要你传过来
        int id = 14;
        int a;
       a = l.deleteLog(id);
       if(a==1){
           System.out.println("删除成功");
       }else{
           System.out.println("删除失败");
       }
    }

}
